<?php
$connection = mysqli_connect("localhost","root","","Holm-adressedatabase");

if (isset($_REQUEST["postnummer"])) {
$postnummer = $_REQUEST["postnummer"];

	if (isset($_REQUEST["by"])) { 
		$q = "update postnummer set postnummer.by = '$_REQUEST[by]' where postnummer = $_REQUEST[postnummer]"; 
		$r = mysqli_query($connection,$q);
	}

	$q = "SELECT * FROM postnummer WHERE postnummer =$postnummer";
	$r = mysqli_query($connection,$q);
	$record = mysqli_fetch_array($r);

 echo "<form action=Retpostnummer.php />";
 echo "<table border=1>";
 echo "<tr>";
 echo "<th>postnummer:</th>";
 echo           "<td>$postnummer</td>";
 echo       "</tr>";
 echo      "<tr>";
 echo       	"<th>by</th>";
 echo           "<td><input type='text' name='by' value='$record[by]' /></td>";
 echo       "</tr>";
 echo     "<tr>";
 echo "<input type='hidden' name='postnummer' value=$postnummer>";

 echo "<td> <input type='submit' value='opdater' /> </td>";

 echo "</tr>";

 echo "</table>";

 echo "</form>";

 echo "<a href=postnummer.php>return to Mars </a href>";	
}



?>